package com.hk.service.impl.kyc;

import com.hk.commons.HqlFilter;
import org.springframework.stereotype.Service;

import com.hk.commons.LongId;
import com.hk.commons.entity.Question;
import com.hk.dao.base.impl.BaseServiceImpl;
import com.hk.service.kyc.IQuestion;


@Service
public class QuestionImpl extends BaseServiceImpl<Question> implements IQuestion {

    @Override
    public Question findById(long id) {

        return getById(id);
    }

    @Override
    public Long add(Question model) {
        long id = LongId.get();
        model.setCts(System.currentTimeMillis());
        model.setId(id);
        super.save(model);
        return id;
    }

    @Override
    public Question findBySeqNumAndGroupId(Long seqNum, Long groupId) {

        HqlFilter hqlFilter = new HqlFilter();

        if (groupId == null)
            groupId = 1L;

        hqlFilter.addEQFilter("groupId", groupId);
        hqlFilter.addEQFilter("seqNum", seqNum);


        return getByFilter(hqlFilter);
    }


}
